<template>
    <nav class="bottom-nav">
        <div 
            class="nav-item" 
            :class="{ active: activeTab === 'home' }" 
            @click="toHome"
        >
            <i class="fas fa-home"></i>
            <span>首页</span>
        </div>
        <div 
            class="nav-item" 
            :class="{ active: activeTab === 'mine' }" 
            @click="toPersonal"
        >
            <i class="fas fa-user"></i>
            <span>我的</span>
        </div>
    </nav>
</template>

<script>
import { useRouter } from 'vue-router';

export default {
    setup(){
        const router  = useRouter();
        function toHome(){
            router.push("/home");
        }
        function toPersonal(){
            router.push("/personal");
        }
        return{
            toHome,
            toPersonal
        }
    },
    props: {
        activeTab: {
            type: String,
            required: true,
            default: 'home' // Default to home if not provided
        }
    }
}
</script>

<style scoped>
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 15vw;
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -0.5vw 2vw rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1vw;
    color: #666;
    font-size: 3vw;
    cursor: pointer;
    user-select: none;
    flex: 1;
    height: 100%;
    justify-content: center;
    transition: color 0.2s;
}

.nav-item i {
    font-size: 5vw;
    transition: transform 0.2s;
    margin-bottom: 0.5vw;
}

.nav-item.active {
    color: #2196F3;
}

.nav-item.active i {
    transform: scale(1.1);
}
</style>